import request from '@/utils/request'

// 查询关键字数据集列表
export function listWordOnlineKeyWord(query) {
  return request({
    url: '/word/wordOnlineKeyWord/list',
    method: 'get',
    params: query
  })
}

// 查询关键字数据集详细
export function getWordOnlineKeyWord(id) {
  return request({
    url: '/word/wordOnlineKeyWord/' + id,
    method: 'get'
  })
}

// 保存关键字数据集
export function saveWordOnlineKeyWord(data) {
  return request({
    url: '/word/wordOnlineKeyWord/save',
    method: 'post',
    data: data
  })
}

// 删除关键字数据集
export function delWordOnlineKeyWord(id) {
  return request({
    url: '/word/wordOnlineKeyWord/' + id,
    method: 'delete'
  })
}

// 导出关键字数据集
export function exportWordOnlineKeyWord(query) {
  return request({
    url: '/word/wordOnlineKeyWord/export',
    method: 'get',
    params: query
  })
}

// 校验唯一标识重复
export function checkCodeRepeat(code) {
  return request({
    url: '/word/wordOnlineKeyWord/checkCodeRepeat/' + code,
    method: 'get'
  })
}

// 校验唯一标识简称重复
export function checkCodeFlagRepeat(codeFlag) {
  return request({
    url: '/word/wordOnlineKeyWord/checkCodeFlagRepeat/' + codeFlag,
    method: 'get'
  })
}

// 校验名称唯一重复
export function checkKeywordLabel(name) {
  return request({
    url: '/word/wordOnlineKeyWord/checkKeywordLabel/' + name,
    method: 'get'
  })
}

// 创建空白模板
export function createWord(fileName) {
  return request({
    url: '/word/wordTemplateKeyword/createWord/' + fileName,
    method: 'get'
  })
}

// 发布指标
export function operateInfo(id, secretKey, schema, syncId) {
  return request({
    url: '/word/wordOnlineKeyWord/publish/' + id + '/' + secretKey + '/' + schema + '/' + syncId,
    method: 'post'
  })
}

// 获取所有的视图指标和字段(用作参数关联)
export function getColumnOfKeyList() {
  return request({
    url: '/word/wordOnlineKeyWord/getColumnOfKeyList',
    method: 'get'
  })
}

// 获取所有指标和字段(用作参数关联)
export function getColumnOfKeyListByType(dataType) {
  return request({
    url: '/word/wordOnlineKeyWord/getColumnOfKeyListByType/' + dataType,
    method: 'get'
  })
}

// 根据参数的信息查询该指标的结果
export function getResultByParamId(id) {
  return request({
    url: '/word/wordOnlineKeyWord/getResultByParamId/' + id,
    method: 'get'
  })
}

// 查询引用/被引用的情况列表
export function quoteList(query, type) {
  return request({
    url: '/word/wordOnlineKeyWord/quoteList/' + type,
    method: 'get',
    params: query
  })
}

// 检测全部指标
export function checkAllKey() {
  return request({
    url: '/word/wordOnlineKeyWord/checkAllKey',
    method: 'post'
  })
}

// 查询以某个指标为根节点的被引用关系树
export function keyQuoteTree(query) {
  return request({
    url: '/word/wordOnlineKeyQuote/keyQuoteTree',
    method: 'get',
    params: query
  })
}

// 查询以某个指标为根节点的引用关系树
export function quotekeyTree(query) {
  return request({
    url: '/word/wordOnlineKeyQuote/quotekeyTree',
    method: 'get',
    params: query
  })
}

// 指标关系树总览
export function getKeyRelationShipChartData(query) {
  return request({
    url: '/word/wordOnlineKeyWord/getKeyRelationShipChartData',
    method: 'get',
    params: query
  })
}

// 同步多数据源的指标数据
export function syncDataSourceData() {
  return request({
    url: '/word/wordOnlineKeyWord/syncDataSourceData',
    method: 'get'
  })
}
